﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace EzDesk.Core.Model
{
    [DataContract]
    public static class ModelExt
    {
        public static UserProfile ToUserProfile(this SimpleUser user)
        {
            if (user == null) return null;
            return new UserProfile
            {
                Id = user.Id,
                Name = user.Name,
                UserCode = user.UserName
            };
        }

        public static SimpleUser ToSimpleUser(this UserProfile user)
        {
            if (user == null) return null;
            return new SimpleUser
            {
                Id = user.Id,
                Name = user.Name,
                UserName = user.UserCode
            };
        }
    }
}
